<?php

namespace App;

use DB;
use Illuminate\Database\Eloquent\Model;
use Storage;

/**
 * Class Ztarticle
 *
 * @package App
 * @mixin \Eloquent
 */
class Zxarticle extends Model
{
    public $timestamps = false;
    protected $table = 'kl_article';

 
    /**
     * 添加文章
     * @param $request
     * @return array
     */
    static function artPublish($request)
    {
        $article = new Zxarticle();

        $article->content = $request->content;
		$article->title = $request->title;
		
        if (!$article->save()) {
            return ['status' => 2, 'message' => '添加失败'];
        }

        return ['status' => 1, 'message' => '添加成功'];
    }


    /**
     * 修改文章
     * @param $request
     * @param $Ztfenlei
     * @return array
     */
    static function artModify($request, $Ztarticle)
    {

		$Zxarticle->article_id = $request->article_id;
		
        if (!$Zxarticle->save()) {
            return ['status' => 2, 'message' => '修改失败'];
        }

        return ['status' => 1, 'message' => '修改成功'];
    }
}
